package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.CompDao;
import com.pti.usermanager.dao.mapper.CompMapper;
import com.pti.usermanager.dao.po.CompPo;
import com.pti.usermanager.web.dto.request.SaveCompRequest;
import com.pti.usermanager.web.dto.request.UpdateCompRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: CompDaoImpl
 * @Author: dongzhipeng
 * @Description: 单位数据交换实现层
 * @Date: 2019/1/18
 */
@Repository
public class CompDaoImpl implements CompDao {

    private static final Logger logger = LogManager.getLogger(CompDaoImpl.class);

    @Autowired
    private CompMapper compMapper;


    @Override
    public CompPo findAllByCompId(Long compId) {
        return compMapper.findAllByCompId(compId);
    }

    @Override
    public List<CompPo> findTreeByComp() {
        return compMapper.findTreeByComp();
    }

    @Override
    public List<CompPo> findAllComp(String compNm) {
        return compMapper.findAllComp(compNm);
    }

    @Override
    public void saveComp(SaveCompRequest saveCompRequest) {
        compMapper.saveComp(saveCompRequest);
    }

    @Override
    public void updateComp(UpdateCompRequest updateCompRequest) {
        compMapper.updateComp(updateCompRequest);
    }

    @Override
    public void delComp(Long compId) {
        compMapper.delComp(compId);
    }

    @Override
    public void saveDeptByCidAndDid(Long compId, Long deptId) {
        compMapper.saveDeptByCidAndDid(compId,deptId);
    }

    @Override
    public void deleteDeptByCid(Long compId) {
        compMapper.deleteDeptByCid(compId);
    }
}
